<?php

namespace app\admin\controller;

use app\admin\service\ConfigService;
use app\admin\service\SmsService;

/**
 * @desc 短信管理
 * Class Sms
 * @package app\admin\controller
 */
class Sms extends CommonController
{
    // 系统上传配置
    public function config()
    {
        if ($this->isAjax())
        {
            $request = $this->request;
            $formData = $request['form'];
            ConfigService::setConf('sys_sms', 'admin', $formData);
            return $this->success();
        }

        $data = ConfigService::getConf('sys_sms', 'admin');
        // 短信类型
        $type = SmsService::getSmsType();

        return view('sms/config', ['data' => $data, 'type' => $type]);
    }
}
